package com.spzx.JUC2.test3;


public class ChangeNumber extends Number {
    public static void main(String[] args) throws InterruptedException {
        Number number = new Number();

        new Thread(()->{
            for (int i = 1; i < 11; i++) {
                try {
                    number.add();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        },"AAA").start();

        new Thread(()->{
            for (int i = 1; i < 11; i++) {
                try {
                    number.minus();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        },"BBB").start();

        new Thread(()->{
            for (int i = 1; i < 11; i++) {
                try {
                    number.add();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        },"CCC").start();

        new Thread(()->{
            for (int i = 1; i < 11; i++) {
                try {
                    number.minus();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        },"DDD").start();
    }
}
